﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CubicFWNet.Data.Models;
using CubicFWNet.Data.SystemManager;
using CubicFWNet.Data.ViewModal;

namespace CubicFWNet.Application.SystemManager
{
    public class InventoryChangeApplyApp
    {
        InventoryChangeApplyRepository _inventoryChangeApplyRepository = new InventoryChangeApplyRepository();

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="inu"></param>
        /// <returns></returns>
        public int Add(InventoryChangeApply ica)
        {
            return _inventoryChangeApplyRepository.Insert(ica);
        }

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="inu"></param>
        /// <returns></returns>
        public int Update(InventoryChangeApply ica)
        {
            return _inventoryChangeApplyRepository.Update(ica);
        }

        public InventoryChangeApply GetInventoryChangeApplyInfo(Guid id)
        {
            return _inventoryChangeApplyRepository.FindEntity(a => a.Id == id);
        }

        public IEnumerable<InventoryChangeApplyView> GetInventoryChangeApplyList()
        {
            return _inventoryChangeApplyRepository.GetInventoryChangeApplyList().OrderByDescending(a=>a.Status).OrderByDescending(a=>a.ApplyTime);
        }
    }
}
